<!--
 * @Description: 
 * @Author: wanggang
 * @Date: 2019-08-02 17:28:43
 -->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
   var a = {
       a:1
   }
   var b = {
       b:1
   }
  var  c={
       c:1
   }
    let list1 = [{age: 18,name: '11111'},2,3,4,5,10,23]
    let list2 = [2,3,6,7,9,98,{age: 17,name:'2222'},54,34,23,21]

// 获取数组中新增的元素
    function add_msg(a,b){
        return a.filter(function(i){
            return b.indexOf(i) === -1
        })
    }
    let s = add_msg(list2,list1);
    console.log(s);
        
// 获取数组中删除的元素
    function delete_msg(a,b){
        return b.filter(function(i){
            return a.indexOf(i) === -1
        })
    }
// 获取数组中不变的元素
    s = delete_msg(list2,list1);
    console.log(s);
    
    function same_msg(a,b){
        return a.filter(function(i){
            return b.indexOf(i) !==-1;
        })
    }

    s=same_msg(list2,list1);
    console.log(s);

</script>
</html>